package com.newsnetwork.api.controller.article;

import com.newsnetwork.grace.result.CommonJSONResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

/**
 * @author HuangDekai
 * @date 2022/11/12 11:14
 * @Description: 门户端文章业务的controller
 */
@Api(value = "门户端文章业务的controller", tags = {"门户端文章业务的controller"})
@RequestMapping("portal/article")
public interface ArticlePortalControllerApi {


    @GetMapping("list")
    @ApiOperation(value = "门户端查询文章列表", notes = "门户端查询文章列表", httpMethod = "GET")
    CommonJSONResult list(@ApiParam(name = "keyword", value = "关键词", required = false)
                          @RequestParam String keyword,

                          @ApiParam(name = "category", value = "分类", required = false)
                          @RequestParam Integer category,

                          @ApiParam(name = "page", value = "查询下一页的第几页", required = false)
                          @RequestParam Integer page,

                          @ApiParam(name = "pageSize", value = "分页中每一页显示的条数", required = false)
                          @RequestParam Integer pageSize);

    @GetMapping("hotList")
    @ApiOperation(value = "首页查询热闻列表", notes = "首页查询热闻列表", httpMethod = "GET")
    CommonJSONResult hotList();

    @GetMapping("queryArticleListOfWriter")
    @ApiOperation(value = "作者信息页查询作者文章列表", notes = "作者信息页查询作者文章列表", httpMethod = "GET")
    CommonJSONResult queryArticleListOfWriter(@ApiParam(name = "writerId", value = "作者Id", required = true)
                                              @RequestParam String writerId,

                                              @ApiParam(name = "page", value = "查询下一页的第几页", required = false)
                                              @RequestParam Integer page,

                                              @ApiParam(name = "pageSize", value = "分页中每一页显示的条数", required = false)
                                              @RequestParam Integer pageSize);

    @GetMapping("queryGoodArticleListOfWriter")
    @ApiOperation(value = "作家页面查询近期佳文", notes = "作家页面查询近期佳文", httpMethod = "GET")
    CommonJSONResult queryGoodArticleListOfWriter(@ApiParam(name = "writerId", value = "作者Id", required = true)
                                                  @RequestParam String writerId);

    @GetMapping("detail")
    @ApiOperation(value = "文章详情查询", notes = "文章详情查询", httpMethod = "GET")
    CommonJSONResult detail(@ApiParam(name = "articleId", value = "文章Id", required = true)
                            @RequestParam String articleId);

    @GetMapping("readCounts")
    @ApiOperation(value = "获得文章阅读数", notes = "获得文章阅读数", httpMethod = "GET")
    Integer readCounts(@ApiParam(name = "articleId", value = "文章Id", required = true)
                                @RequestParam String articleId);

    @PostMapping("readArticle")
    @ApiOperation(value = "阅读文章，文章阅读量累加", notes = "阅读文章，文章阅读量累加", httpMethod = "POST")
    CommonJSONResult readArticle(@RequestParam String articleId, HttpServletRequest request);
}
